#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 3010;
const int INTMAX = 1e9 + 10;

int n, m;
int f[N][N][2];  // f[i][j][0/1] 遍历到第i个数字和为j当前数字选或不选的 的最少次数   0不选 1选
int a[N];

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> m;

    for(int i = 1; i <= n; i ++) cin >> a[i];

    for(int i = 0; i <= n; i ++){
        for(int j = 0; j <= m; j ++){
            f[i][j][0] = f[i][j][1] = INTMAX;
        }
    }

    f[0][0][1] = 0;

    for(int i = 1; i <= n; i ++){
        for(int j = 0; j <= m; j ++){
            f[i][j][0] = min(f[i - 1][j][0], f[i - 1][j][1] + 1);

            if(j >= a[i]){
                f[i][j][1] = min(f[i - 1][j - a[i]][0], f[i - 1][j - a[i]][1]);
            }
        }
    }

    for(int i = 1; i <= m; i ++){
        if(min(f[n][i][0], f[n][i][1]) >= INTMAX){
            cout << -1 << '\n';
        }else{
            cout << min(f[n][i][0], f[n][i][1]) << '\n';
        }
    }


    return 0;
}